package com.example.dingtalklogin.manager.dingtalk;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 钉钉token请求client声明
 * @author xuzhen97
 */
@FeignClient(name = "dingtalkTokenClient",url = "https://api.dingtalk.com")
@Component
public interface DingtalkTokenClient {

    /**
     * 获取企业内部应用Token
     * @param appKey
     * @param appSecret
     * @return
     */
    @GetMapping("/gettoken")
    EnterpriseTokenResponse getToken(@RequestParam("appkey") String appKey
            , @RequestParam("appsecret") String appSecret);

    /**
     * 获取用户token
     * @param request
     * @return
     */
    @PostMapping("/v1.0/oauth2/userAccessToken")
    UserTokenResponse getUserToken(@RequestBody UserTokenRequest request);
}
